/* grytole@gmail.com 28-Jun-2012 */

#include <stdio.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"

void usage()
{
  printf( "Usage: sdlua FILE\r\n" );
  printf( "Runs Lua script in sdlua environment.\r\n" );
  printf( "\r\n" );
  printf( "Feedback: <grytole@gmail.com>\r\n" );
}

int main( int argc, char **argv )
{
  lua_State *pstLua = NULL;

  if( 2 != argc )
  {
    usage();
    return 0;
  }

  pstLua = luaL_newstate();
  if( NULL == pstLua )
  {
    printf( "Failed to init Lua\r\n" );
    return 1;
  }

  luaL_openlibs( pstLua );

  if( 0 != luaL_dofile( pstLua, argv[1] ) )
  {
    printf( "Failed to run Lua script\r\n" );
  }

  lua_close( pstLua );

  return 0;
}

/* eof */
